<?php
include('../../include/functions.inc.php');
include('../../include/inputbuilder.inc.php');
include('../../include/maintenance.inc.php');
if (isEmpty(getParam('ID'))) {
    echo 'WRONG PARAMETER';
} else {
    $maintenance = unserialize($_SESSION['mCareer']);
    $list = $db->query_select("cllg_entity", NULL);
    $rows = $db->query_select($maintenance->table, sprintf("ID=%s", getParam('ID')));

    foreach ($rows as $row) {
        ?>
        <form id="<?php echo $maintenance->formName; ?>" name="<?php echo $maintenance->formName; ?>" method="POST" action="<?php echo $maintenance->updateUrlPage; ?>">
            <table class=""  width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <th scope="col"><legend>DATOS Diplomado</legend></th>
                    <th scope="col"><legend><div class="btn-group" style="margin-left: 30%;margin-top: 1.4%">
                        <input type="button" name="politicas" id="politicas"  class="btn btn-info" onclick="javascript:loadLocal('../career_policies','CAREER=<?php echo $row['ID']; ?>');" value="Cargos" />
                        <input type="button" name="cmdOk" id="cmdOk" value="Guardar" class="btn btn-info" onClick="formOkBt($(this.form),updateAction);jQuery('#cmAddcontainer').show();" />
                        <input type="button" name="eliminar" id="eliminar" onclick="javascript:deleteAction('<?php echo $maintenance->deleteUrlPage; ?>',<?php echo $maintenance->getDeleteUrl(); ?>);jQuery('#cmAddcontainer').show();" value="Borrar" class="btn btn-info" />        
                        <input type="button" name="cmdCancel" id="cmdCancel" value="Cancelar" class="btn btn-info" onClick="loadTable();jQuery('#cmAddcontainer').show();" /></div></th>
                </tr>
                <tr>
                    <td colspan="2"><br/><table width="100%" border="0" cellspacing="0" cellpadding="0">

                            <tr>
                                <td width="15%">* NOMBRE </td>
                                <td width="85%"><input name="NAME" type="text" id="NAME" value="<?php echo $row['NAME']; ?>" />
                                    <input name="ID" type="hidden" id="ID" value="<?php echo $row['ID']; ?>" /></td>
                            </tr>
                            <tr>
                                <td>ENTIDAD</td>
                                <td><select name="FK_ENTITY" id="FK_ENTITY">
                                        <?php foreach ($list as $it) { ?>
                                            <option value="<?php echo $it["ID"]; ?>" 
                                            <?php
                                            if (!(strcmp($it["ID"], $row['FK_ENTITY']))) {
                                                echo "selected=\"selected\"";
                                            }
                                            ?>> 
            <?php echo $it["NAME"]; ?> </option>
        <?php } ?>
                                    </select></td>
                            </tr>



                        </table></td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
            </table>
        </form>  
        <?php
    }
}
?>
